package com.example.demo.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.Jedis;

import javax.annotation.Resource;
import java.util.Random;

@RestController
@Slf4j
@RequestMapping("/ethan")
public class RedisController {

  @Resource
  private Jedis jedis;

  @GetMapping("/hello/redis")
  public String helloRedis(){
    return "Hello Redis";
  }

  @GetMapping("/redis/first")
  public String firstController(){
    String value = this.jedis.ping();
    System.out.println(value);
    return value;
  }

  @GetMapping("/redis/second")
  public String secondController(){
    Random random = new Random();
    random.ints(1);

    return "";
  }
}
